<template>
    <el-form :model="gStoraneboxForm" status-icon :rules="rules" ref="gStoraneboxForm"
             label-width="150px"
             style="margin-top: 10px;color: #1f2d3d">
        <el-form-item class="form-label" label="储气罐编码" prop="boxnum">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.boxnum" placeholder="储气罐编码"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="储气罐名称" prop="name">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.name" placeholder="储气罐名称"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="经度" prop="longitude">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.longitude" placeholder="经度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="纬度" prop="latitude">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.latitude" placeholder="纬度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="型号" prop="style">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.style" placeholder="型号"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="公称容量" prop="capacity">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.capacity" placeholder="公称容量(m³)"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="工作压力" prop="pressure">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.pressure" placeholder="工作压力"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="筒体直径" prop="innerDiameter">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.innerDiameter" placeholder="筒体直径"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="筒体高度" prop="height">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.height" placeholder="筒体高度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="筒体、封头壁厚" prop="thickness">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.thickness" placeholder="筒体、封头壁厚(mm)"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="参考重量" prop="weight">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.weight" placeholder="参考重量"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="结构材料" prop="material">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.material" placeholder="结构材料"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="导轨长度" prop="railLength">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.railLength" placeholder="导轨长度(m)"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="导轨高度" prop="railHeight">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.railHeight" placeholder="导轨高度(m)"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="导轨中腹厚度" prop="midThickness">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.midThickness" placeholder="导轨中腹厚度(m)"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="基础形式" prop="baseType">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.baseType" placeholder="基础形式"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="材料型号" prop="materialType">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.materialType" placeholder="材料型号"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="弹性模量" prop="elasticityModulus">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.elasticityModulus" placeholder="弹性模量(Map)"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="屈服应力" prop="yieldStress">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.yieldStress" placeholder="屈服应力(Map)"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="许用应力" prop="permissibleStress">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.permissibleStress" placeholder="许用应力(Map)"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="场地类别" prop="site">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.site" placeholder="场地类别"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="6度时液化程度" prop="liquefaction6">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.liquefaction6" placeholder="6度时液化程度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="7度时液化程度" prop="liquefaction7">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.liquefaction7" placeholder="7度时液化程度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="8度时液化程度" prop="liquefaction8">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.liquefaction8" placeholder="8度时液化程度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="9度时液化程度" prop="liquefaction9">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.liquefaction9" placeholder="9度时液化程度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="6度时震陷程度" prop="seismicsubsidence6">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.seismicsubsidence6" placeholder="6度时震陷程度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="7度时震陷程度" prop="seismicsubsidence7">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.seismicsubsidence7" placeholder="7度时震陷程度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="8度时震陷程度" prop="seismicsubsidence8">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.seismicsubsidence8" placeholder="8度时震陷程度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="9度时震陷程度" prop="seismicsubsidence9">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.seismicsubsidence9" placeholder="9度时震陷程度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="建设年代" prop="year">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.year" placeholder="建设年代"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="设防烈度" prop="intensity">
            <el-col :span="19">
                <el-input v-model="gStoraneboxForm.intensity" placeholder="设防烈度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="关联子任务" prop="sid" style="display: none">
            <el-input v-model="gStoraneboxForm.sid"
                      maxlength="20" autocomplete="off"/>
        </el-form-item>
    </el-form>
</template>

<script>
    import qs from 'qs';

    export default {
        name: "NewGasStoranebox",
        data() {
            return {
                gStoraneboxForm: {
                    id: '',
                    boxnum: '',
                    name: '',
                    longitude: '',
                    latitude: '',
                    style: '',
                    capacity: '',
                    pressure: '',
                    innerDiameter: '',
                    height: '',
                    thickness: '',
                    weight: '',
                    material: '',
                    railLength: '',
                    railHeight: '',
                    midThickness: '',
                    baseType: '',
                    materialType: '',
                    elasticityModulus: '',
                    yieldStress: '',
                    permissibleStress: '',
                    site: '',
                    liquefaction6: '',
                    liquefaction7: '',
                    liquefaction8: '',
                    liquefaction9: '',
                    seismicsubsidence6: '',
                    seismicsubsidence7: '',
                    seismicsubsidence8: '',
                    seismicsubsidence9: '',
                    year: '',
                    intensity: '',
                    sid: ''
                },
                rules: {
                    boxnum: [],
                    name: [],
                    longitude: [],
                    latitude: [],
                    style: [],
                    capacity: [],
                    pressure: [],
                    innerDiameter: [],
                    height: [],
                    thickness: [],
                    weight: [],
                    material: [],
                    railLength: '',
                    railHeight: '',
                    midThickness: '',
                    baseType: '',
                    materialType: '',
                    elasticityModulus: '',
                    yieldStress: '',
                    permissibleStress: '',
                    site: '',
                    liquefaction6: [],
                    liquefaction7: [],
                    liquefaction8: [],
                    liquefaction9: [],
                    seismicsubsidence6: [],
                    seismicsubsidence7: [],
                    seismicsubsidence8: [],
                    seismicsubsidence9: [],
                    year: [],
                    intensity: [],
                    sid: []
                }
            }
        },
        mounted() {
            if (this.id !== -1) {
                axios.post("/bjdzms/gasStorageboxData/findById",
                    qs.stringify({
                        'id': this.id
                    })).then(res => {
                    this.gStoraneboxForm = res.data.datas;
                });
            }
        },
        props: {
            sid: {
                type: Number,
                default: -1
            },
            id: {
                type: Number,
                default: -1
            }
        },
        methods: {
            to(path) {
                this.$router.push({name: path});
            },
            submitForm() {
                if (this.id !== -1) {
                    this.gStoraneboxForm.id = this.id;
                    axios.post("/bjdzms/gasStorageboxData/upd",
                        qs.stringify(this.gStoraneboxForm)
                    ).then(res => {
                        this.$emit('updateData');
                    });
                } else {
                    this.gStoraneboxForm.sid = this.sid;
                    axios.post("/bjdzms/gasStorageboxData/add",
                        qs.stringify(this.gStoraneboxForm)
                    ).then(res => {
                        this.$emit('updateData');
                    });
                }
            }
        }
    }
</script>

<style>
    .el-upload-dragger {
        height: 40px !important;
    }
</style>

<style scoped>
    .el-header {
        background: #EBEBEB;
        color: #e5e9ef;
        font-size: 2em;
        line-height: 80px;
        border: 5px solid #EBEBEB;
    }

    .el-main {
        background: #fff;
    }

    .el-container {
        height: 100%;
    }

    .el-form-item {
        width: 610px;
    }
</style>

